//class made by Teo ( www.teodorfilimon.com ). More about the app in readme.txt

package com.teo.tools.counter.units;

public class Unit {
	private int mDivider;
	private String mName;

	public Unit(int divider, String name) {
		mDivider = divider;
		mName = name;
	}

	/**
	 * @param millis
	 * @return converted value to the represented unit
	 */
	public double getValue(long millis) {
		return (double) millis / mDivider;
	}

	/**
	 * @param millis
	 * @return an appropriate String representation of the converted numeric
	 *         value
	 */
	public String getStringValue(long millis) {
		return mDivider != 1 ? Double.toString(getValue(millis)) : Integer
				.toString((int) getValue(millis));
	}

	@Override
	public String toString() {
		return mName;
	}
}
